using System.Data.Common;

namespace ODX.Core
{
    internal class OdxProviderFactory : IProviderFactory
    {
        private DbProviderFactory factory;

        public OdxProviderFactory(string providerInvariantName)
        {
            factory = DbProviderFactories.GetFactory(providerInvariantName);
        }
        public OdxProviderFactory(DbProviderFactory factory)
        {
            this.factory = factory;
        }

        public DbConnection CreateConnection()
        {
            return factory.CreateConnection();
        }

        public DbDataAdapter CreateDataAdapter()
        {
            return factory.CreateDataAdapter();
        }

        public DbCommandBuilder CreateCommandBuilder()
        {
            return factory.CreateCommandBuilder();
        }
    }
}
